import React, { Component } from 'react'
import { View, Text, Image, StyleSheet } from 'react-native'
import { connect } from 'react-redux'
import { pTx } from "../utils/dimensions"


export class FriendTransferInApp extends Component {
    constructor(props) {
        super(props)
        this.state = {
            item: props.item,
            M: props.item.M?.split(' ')
        }
    }
    render() {
        return (
            <View style={styles.blcok}>
                <View style={styles.card}>
                    <Image style={styles.cardImage}
                        source={require('../assets/image/icon34.png')}
                    ></Image>
                    <View>
                        <Text style={styles.amount} >${this.state.M[1]}</Text>
                        {this.state.item.S == -1 ?
                            <Text style={styles.cardName} >你发起了一笔转账</Text>
                            :
                            <Text style={styles.cardName} >已收款</Text>
                        }
                    </View>
                </View>
                <Text style={styles.styleText}>{['USDT', 'Tweet'][this.state.M[0]]}转账</Text>
            </View>
        )
    }
}

const mapStateToProps = (state) => ({})

const mapDispatchToProps = {}

export default connect(mapStateToProps, mapDispatchToProps)(FriendTransferInApp)

const styles = StyleSheet.create({
    blcok: {
        marginTop: pTx(10),
        backgroundColor: "#FB9F3C",
        width: pTx(230),
        borderRadius: pTx(6),
    },
    card: {
        flexDirection: "row",
        alignItems: "center",
        marginHorizontal: pTx(15),
        paddingVertical: pTx(10),
        borderBottomColor: "rgba(255,255,255,0.1)",
        borderBottomWidth: 1,
    },
    cardImage: {
        width: pTx(40),
        height: pTx(40),
    },
    amount: {
        marginLeft: pTx(15),
        fontSize: pTx(13),
        color: "#fff"
    },
    cardName: {
        marginTop: pTx(2),
        marginLeft: pTx(15),
        fontSize: pTx(13),
        color: "#fff"
    },
    styleText: {
        paddingHorizontal: pTx(15),
        fontSize: pTx(12),
        color: "#fff",
        paddingVertical: pTx(3),
    }
})